﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for Customer
/// </summary>
namespace Triax.Modules.Department
{
    public class A0_UserCSDL
    {
        #region Phần dữ liệu chung của các object
        private int _ModuleId;
        private int _id;
        private DateTime _InsertDate;
        private DateTime _updateDate;
        private int _createByUser;
        private int _UpdateByUser;

        public int ModuleId { get { return _ModuleId; } set { _ModuleId = value; } }
        public int id { get { return _id; } set { _id = value; } }
        public DateTime InsertDate { get { return _InsertDate; } set { _InsertDate = value; } }
        public DateTime updateDate { get { return _updateDate; } set { _updateDate = value; } }
        public int createByUser { get { return _createByUser; } set { _createByUser = value; } }
        public int UpdateByUser { get { return _UpdateByUser; } set { _UpdateByUser = value; } }
        #endregion

        private int _UserID;
        public int UserID { get { if (_UserID is int) return (int)_UserID; return 0; } set { _UserID = value; } }

        private string _ListCSDL;
        public string ListCSDL { get { if (_ListCSDL is string) return (string)_ListCSDL; return ""; } set { _ListCSDL = value; } }
    }

    public class Instance_A0_UserCSDL
    {
        public static string[] GetDBNameByUserID(string userID)
        {
            string[] lst = null;
            A0_UserCSDL obj = CustomerController.Instance.db.SingleOrDefault<A0_UserCSDL>("SELECT * FROM A0_UserCSDL WHERE UserID=@0", userID);
            if(obj != null)
            {
                lst = obj.ListCSDL.Split(',');
            }

            return lst;
        }

    }
}